<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>文章列表</title>
  <link rel="stylesheet" href="/static/css/font.css">
  <link rel="stylesheet" href="/static/css/index.css">
  <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="/static/js/index.js"></script>
</head>
<body>
<div class="x-nav">
  <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
    <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-body ">
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="submit" onclick="pendingReview()"><i class="layui-icon">待审核</i></button>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="submit" onclick="published()"><i class="layui-icon">已发布</i></button>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="submit" onclick="didNotPass()"><i class="layui-icon">未通过</i></button>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="submit" onclick="allShare()"><i class="layui-icon">所有</i></button>
        </div>
        <div class="layui-card-body layui-table-body layui-table-main">
          <table class="layui-table layui-form" align="center">
            <thead >
            <tr>
              <th>ID</th>
              <th>标题</th>
              <th>作者</th>
              <th>内容</th>
              <th>发布时间</th>
              <th>状态</th>
              <th>操作</th></tr>
            </thead>
            <tbody >
            <tr  th:each="list,listStat:${shareList}">
              <td th:text="${listStat.index+1}"></td>
              <td th:text="${list.shareTitle}" style="max-width: 100px;overflow: hidden; text-overflow:ellipsis;white-space: nowrap"></td>
              <td th:text="${list.userInfo.userName}"></td>
              <td th:text="${list.shareContent}" style="max-width: 100px;overflow: hidden; text-overflow:ellipsis;white-space: nowrap"></td>
              <td th:text="${list.shareTime}"></td>
              <td class="td-status">
                <span class="layui-btn layui-btn-warm layui-btn-mini"  th:if="${list.shareStatus} == 0">待审核</span>
                <span class="layui-btn layui-btn layui-btn-mini"  th:if="${list.shareStatus} == 1">已发布</span>
                <span class="layui-btn layui-btn-danger layui-btn-mini"  th:if="${list.shareStatus} == 2">不通过</span></td>
              <td class="td-manage">
                <a title="查看" th:onclick="member_look(this,[[${list.shareId}]])" href="javascript:;">
                  <button class="layui-btn layui-btn-normal layui-btn-mini" style="padding-top: 5px"><svg t="1662515179976" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5144" width="20" height="20"><path d="M956 624.752C847.632 771.248 689.056 863.872 512 863.872 334.96 863.872 176.384 771.248 68 624.752 20.144 560.08 20.144 463.952 68 399.264 176.384 252.768 334.96 160.144 512 160.144 689.056 160.144 847.632 252.768 956 399.264 1003.856 463.952 1003.856 560.08 956 624.752ZM907.872 452.384C807.344 307.328 662.656 224.144 510.912 224.144 359.168 224.144 214.48 307.328 113.952 452.384 90 486.944 90 537.104 113.952 571.664 214.48 716.72 359.168 799.92 510.912 799.92 662.656 799.92 807.344 716.72 907.872 571.648 931.824 537.104 931.824 486.944 907.872 452.384ZM512.32 735.824C388.608 735.824 288.32 635.536 288.32 511.824 288.32 388.112 388.608 287.824 512.32 287.824 636.032 287.824 736.32 388.112 736.32 511.824 736.32 635.536 636.032 735.824 512.32 735.824ZM512.32 351.824C423.952 351.824 352.32 423.456 352.32 511.824 352.32 600.192 423.952 671.824 512.32 671.824 600.688 671.824 672.32 600.192 672.32 511.824 672.32 423.456 600.688 351.824 512.32 351.824Z" p-id="5145" fill="#ffffff"></path></svg></button>
                </a>
                <a title="通过" th:onclick="member_pass(this,[[${list.shareId}]])" href="javascript:;" th:if="${list.shareStatus} == 0">
                  <button class="layui-btn layui-btn-danger layui-btn-mini" style="padding-top: 5px"><svg t="1662520990302" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4144" width="20" height="20"><path d="M210.140533 433.365058 152.777057 491.469408 456.137203 792.703123 1022.028601 185.922457 961.171558 129.083937 453.323111 673.678286Z" p-id="4145" fill="#ffffff"></path><path d="M981.676567 344.580966l-78.668711 23.328311 7.126304 24.035416c11.495822 38.767955 17.326621 79.160921 17.326621 120.06247 0 232.527914-189.18271 421.704484-421.719834 421.704484s-421.719834-189.175547-421.719834-421.704484c0-232.537124 189.18271-421.719834 421.719834-421.719834 107.910709 0 210.571856 40.720424 289.073768 114.660436l18.256806 17.191544 56.239885-59.752896-18.248619-17.183358c-93.797269-88.323605-216.435401-136.966465-345.32184-136.966465-67.981301 0-133.958968 13.323447-196.104353 39.59888-59.972906 25.364691-113.844861 61.684898-160.116721 107.950617-46.257533 46.260603-82.57467 100.129488-107.941408 160.108534-26.281573 62.127989-39.60809 128.108726-39.60809 196.11254 0 67.99051 13.326517 133.968178 39.607066 196.095143 25.367761 59.98007 61.684898 113.848954 107.942431 160.110581 46.273906 46.266743 100.145861 82.58695 160.118767 107.948571 62.138222 26.276457 128.114866 39.599903 196.102307 39.599903s133.966131-13.32447 196.10333-39.599903c59.984163-25.366737 113.855094-61.685921 160.116721-107.949594 46.243207-46.242184 82.562391-100.111069 107.944478-160.108534 26.275433-62.117756 39.597857-128.0944 39.597857-196.096167 0-48.790216-6.965645-97.030917-20.700461-143.382595L981.676567 344.580966z" p-id="4146" fill="#ffffff"></path></svg></button>
                </a>
                <a title="不通过" th:onclick="member_no_pass(this,[[${list.shareId}]])" href="javascript:;" th:if="${list.shareStatus} == 0">
                  <button class="layui-btn layui-btn-danger layui-btn-mini" style="padding-top: 5px"><svg t="1662521055989" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5949" width="20" height="20"><path d="M511.563 65.144c-246.87 0-446.998 200.128-446.998 446.998S264.693 959.14 511.563 959.14 958.56 759.011 958.56 512.141 758.433 65.144 511.563 65.144zM785.211 785.79c-35.561 35.561-76.954 63.473-123.03 82.961-47.672 20.164-98.348 30.388-150.619 30.388s-102.946-10.224-150.619-30.388c-46.076-19.488-87.469-47.401-123.03-82.961-35.561-35.561-63.473-76.954-82.962-123.03-20.164-47.672-30.388-98.348-30.388-150.618s10.224-102.946 30.388-150.619c19.489-46.076 47.401-87.469 82.962-123.03 35.56-35.561 76.954-63.473 123.03-82.962 47.672-20.164 98.348-30.388 150.619-30.388s102.946 10.224 150.619 30.388c46.076 19.489 87.469 47.401 123.03 82.962 35.561 35.56 63.473 76.954 82.962 123.03 20.164 47.672 30.388 98.348 30.388 150.619s-10.224 102.946-30.388 150.618c-19.489 46.076-47.401 87.47-82.962 123.03z" fill="#ffffff" p-id="5950"></path><path d="M690.087 336.983c-11.715-11.716-30.711-11.716-42.426 0L513.535 471.109 379.41 336.983c-11.716-11.716-30.711-11.716-42.427 0-11.715 11.716-11.715 30.711 0 42.427l134.126 134.126-134.126 134.125c-11.715 11.716-11.715 30.71 0 42.426 5.858 5.858 13.536 8.787 21.213 8.787s15.355-2.929 21.213-8.787l134.126-134.126 134.126 134.126c5.857 5.858 13.535 8.787 21.213 8.787s15.355-2.929 21.213-8.787c11.716-11.716 11.716-30.71 0-42.426L555.961 513.535 690.087 379.41c11.716-11.716 11.716-30.711 0-42.427z" fill="#ffffff" p-id="5951"></path></svg></button>
                </a>
              </td>
            </tr>

            </tbody>
          </table>
        </div>
        <!--<div class="layui-card-body ">
          <div class="page">
            <div>
              <a class="prev" href="">&lt;&lt;</a>
              <a class="num" href="">1</a>
              <span class="current">2</span>
              <a class="num" href="">3</a>
              <a class="num" href="">489</a>
              <a class="next" href="">&gt;&gt;</a>
            </div>
          </div>
        </div>-->
      </div>
    </div>
  </div>
</div>
</body>
<script  th:inline="javascript">
  layui.use(['laydate','form'], function(){
    var laydate = layui.laydate;
    var  form = layui.form;

    //执行一个laydate实例
    laydate.render({
      elem: '#start' //指定元素
    });

    //执行一个laydate实例
    laydate.render({
      elem: '#end' //指定元素
    });


  });
  /*通过*/
  function member_pass(obj,id){
    layer.confirm('确认要通过该分享吗？',function(index){
      $.ajax({
        url:'updateShareStatus',
        method:'post',
        async:false,
        data:{'shareId':id,'shareStatus':1},
        success:function (data) {
          res=data;
        }
      });
      if (res=="1"){
        $(obj).parents("tr").remove();
        layer.msg('操作成功!',{icon:1,time:1000});
      }else {
        window.location.href="toErrorPage"
      }
    });
  }
  /*不通过*/
  function member_no_pass(obj,id){
    layer.confirm('确认拒绝通过该分享吗？',function(index){
      $.ajax({
        url:'updateShareStatus',
        method:'post',
        async:false,
        data:{'shareId':id,'shareStatus':2},
        success:function (data) {
          res=data;
        }
      });
      if (res=="1"){
        $(obj).parents("tr").remove();
        layer.msg('操作成功!',{icon:1,time:1000});
      }else {
        window.location.href="toErrorPage"
      }
    });
  }
  /*查看*/
  function member_look(obj,id){
    $.ajax({
      url:'setShare',
      method:'post',
      async:false,
      data:{'shareId':id,'shareStatus':1},
    });
    xadmin.open('查看','lookShare')
  }

  /*待审核*/
  function pendingReview() {
    $.ajax({
      url:'setShare',
      method:'post',
      async:false,
      data:{'shareStatus':0},
    });
    window.location.href='findAllShareByStatus'
  }
  /*已发布*/
  function published() {
    $.ajax({
      url:'setShare',
      method:'post',
      async:false,
      data:{'shareStatus':1},
    });
    window.location.href='findAllShareByStatus'
  }
  /*未通过*/
  function didNotPass() {
    $.ajax({
      url:'setShare',
      method:'post',
      async:false,
      data:{'shareStatus':2},
    });
    window.location.href='findAllShareByStatus'
  }
  /*所有*/
  function allShare() {
    window.location.href='findAllShare'
  }
</script>
</html>